package com.yanqu.road.server.manger.activity.cookboy;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.cookboy.CookBoyData;
import com.yanqu.road.entity.activity.cookboy.process3.CookBoy3OpenItem;
import com.yanqu.road.entity.config.goods.OpenGoodsBagResult;
import com.yanqu.road.entity.enums.activity.eActivityCookBoyType;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.entity.player.UserBagItem;
import com.yanqu.road.entity.player.UserInfo;
import com.yanqu.road.entity.task.args.RelationActivityUnionRiseRankArgs;
import com.yanqu.road.entity.task.args.UnionRiseRankArgs;
import com.yanqu.road.logic.bussiness.player.UserCookBoyBussiness;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.cookboy.CookBoyProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.cookboy.CookBoyModule;
import com.yanqu.road.server.gameplayer.module.player.BagModule;
import com.yanqu.road.server.gameplayer.module.player.CurrencyModule;
import com.yanqu.road.server.manger.activity.RelationActivityMgr;
import com.yanqu.road.server.manger.config.GoodsBagMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CookBoy3 {

	private Logger logger = LogManager.getLogger(CookBoy3.class.getName());

	private final Map<Long,Object> lockMap = new ConcurrentHashMap<>();

	private ActivityInfo activityInfo;

	//用户id 用户数据
	private Map<Long, CookBoyData> cookBoyDataMap = new ConcurrentHashMap<>();

	private List<CookBoyData> needAddCookBoyList = new ArrayList<>();

	private List<CookBoyData> needUpdateCookBoyList = new ArrayList<>();

	//正在发菜场景的人
	private Map<Long,List<Long>> sceneUserMap = new ConcurrentHashMap<>();


	public CookBoy3(ActivityInfo acInfo){
		activityInfo = acInfo;
//		reload();
	}

	public Object getLock(long userId){
		synchronized (lockMap){
			if(!lockMap.containsKey(userId)){
				lockMap.put(userId,new Object());
			}
			return lockMap.get(userId);
		}
	}

	public boolean isSceneUser(long userId,long openBanquetUserId){
		for(Long inUserId : sceneUserMap.get(openBanquetUserId)){
			if(inUserId == userId){
				return true;
			}
		}
		return false;
	}

	public void addPromotionUserList(List<Long> userIdList,Map<Long,CookBoyData> windUpUserCookBoy2Map) {
		windUpCookBoy(userIdList);
		CookBoyProto.CrossCookBoy3CookerJoinSyncMsg.Builder reqMsg = CookBoyProto.CrossCookBoy3CookerJoinSyncMsg.newBuilder();
		reqMsg.setActivityId(activityInfo.getActivityId());
		for(long userId : userIdList){
			CookBoyProto.CrossCookBoyWindUpCookerTempMsg.Builder userMsg = CookBoyProto.CrossCookBoyWindUpCookerTempMsg.newBuilder();
			userMsg.setUserId(userId);
			userMsg.setScore(windUpUserCookBoy2Map.get(userId).getAllIntegral());//不知道哪个前面的活动晋级的
			userMsg.setPlayerBaseData(PlayerBasePb.parsePlayerBaseTempMsg(UserMgr.parseUserBaseInfo(UserMgr.getUserInfo(userId), GameServer.getInstance().getServerId())));
			reqMsg.addUserInfoList(userMsg);
		}
		YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_COOKER_JOIN, reqMsg);
		GamePlayerMgr.sendPacket(0, pbMsg);
	}

	//晋级玩家数据生成
	public void windUpCookBoy(List<Long> userIdList){
		for(Long userId : userIdList){
			if(!cookBoyDataMap.containsKey(userId)){
				cookBoyDataMap.put(userId,initCookBoy3(userId));
			}
			CookBoyData cookBoyData = cookBoyDataMap.get(userId);
			cookBoyData.setAble(true);
			synchronized (needUpdateCookBoyList){
				if(!needUpdateCookBoyList.contains(cookBoyData)){
					needUpdateCookBoyList.add(cookBoyData);
				}
			}
			GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
			if(player != null){
				player.getModule(CookBoyModule.class).syncSelfBanquetTable(activityInfo.getActivityId());
			}
		}
	}

	public int worship(long userId){
		Object locker = getLock(userId);
		synchronized (locker){
			CookBoyData cookBoyData = cookBoyDataMap.get(userId);
			if(cookBoyData.isWorship()){
				return GameErrorCode.E_COOK_BOY_FOOD_IS_WORSHIP;
			}
			GamePlayer gamePlayer = GamePlayerMgr.getOnlinePlayer(userId);
			if(gamePlayer != null){
				cookBoyData.setWorship(true);
				synchronized (needUpdateCookBoyList){
					if(!needUpdateCookBoyList.contains(cookBoyData)){
						needUpdateCookBoyList.add(cookBoyData);
					}
				}
				gamePlayer.getModule(CurrencyModule.class).addCurrency(CookBoyActivityMgr.getWorship3Reward(activityInfo.getActivityId()),eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoyActivityWorship);
			}
		}
		return 0;
	}

	public void addSceneUser(long userId,long openBanquetUserId){
		if(!sceneUserMap.containsKey(openBanquetUserId)){
			sceneUserMap.put(openBanquetUserId,new ArrayList<>());
		}
		for(List<Long> userIdList : sceneUserMap.values()){
			userIdList.remove(userId);
		}
		sceneUserMap.get(openBanquetUserId).add(userId);
	}

	public void removeSceneUser(long userId,long openBanquetUserId){
		if(sceneUserMap.containsKey(openBanquetUserId)){
			sceneUserMap.get(openBanquetUserId).remove(userId);
		}
	}

	public List<Long> getSceneUser(long openBanquetUserId){
		return new ArrayList<>(sceneUserMap.get(openBanquetUserId));
	}

	public String CookBoy3joinerBackMsg(long userId,int banquetItemId){
		Object locker = getLock(userId);
		synchronized (locker){
			String reward = CookBoyActivityMgr.getCookBoy3OpenJoinerReward(activityInfo.getActivityId(),banquetItemId);
			GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);

			OpenGoodsBagResult openReward = GoodsBagMgr.getRandomGoods(StringUtils.stringToIntegerList(reward,"=").get(0));
			player.getModule(CurrencyModule.class).addCurrency(openReward.getReward(),eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoy3JoinBanquetReward);
			return PropertyHelper.parsePropertyToString(openReward.getReward());
		}
	}

	public void cookBoy3RobotBackMsg(long userId,long integral){
		Object locker = getLock(userId);
		synchronized (locker){
			CookBoyData cookBoyData = cookBoyDataMap.get(userId);
			GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
			if(player != null){
				int integralId = CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId());
				String reward = integralId + "=" + integral;
				player.getModule(CurrencyModule.class).addCurrency(reward,eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoy3JoinBanquetOwnerReward);
				player.getModule(CookBoyModule.class).syncSelfBanquetTable(activityInfo.getActivityId());
			}else{
				cookBoyData.setIntegral(cookBoyData.getIntegral() + integral);
			}
			cookBoyData.setAllIntegral(cookBoyData.getAllIntegral() + integral);
			synchronized (needUpdateCookBoyList){
				if(!needUpdateCookBoyList.contains(cookBoyData)){
					needUpdateCookBoyList.add(cookBoyData);
				}
			}
			UserInfo userInfo = UserMgr.getUserInfo(userId);
			RelationActivityMgr.conditionNotify(activityInfo.getActivityId(),userId, eGamePlayerEventType.CookBoy3IntegralUserCrossRank.getValue(),
					new RelationActivityUnionRiseRankArgs(UnionRiseRankArgs.NOTIFY_TYPE_NORMAL, BigInteger.valueOf(integral),userInfo.getUnionUid(), activityInfo.getActivityId()));

		}
	}

	public void cookBoy3OpenerBackMsg(long userId,int banquetItemId){
		Object locker = getLock(userId);
		synchronized (locker){
			CookBoyData cookBoyData = cookBoyDataMap.get(userId);
			CookBoy3OpenItem cookBoy3OpenItem = CookBoyActivityMgr.getCookBoy3OpenItem(activityInfo.getActivityId(),banquetItemId);
			GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
			cookBoyData.setAllIntegral(cookBoyData.getAllIntegral() + cookBoy3OpenItem.getIntegral());
			if(player != null){
				int integralId = CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId());
				String reward = integralId + "=" + cookBoy3OpenItem.getIntegral();
//				player.getModule(CurrencyModule.class).addCurrency(reward,eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoy3JoinBanquetOwnerReward);
				cookBoyData.setIntegral(cookBoyData.getIntegral() + cookBoy3OpenItem.getIntegral());
				lockMap.put(0 - userId, System.currentTimeMillis());
			}else{
				cookBoyData.setIntegral(cookBoyData.getIntegral() + cookBoy3OpenItem.getIntegral());
			}
			synchronized (needUpdateCookBoyList){
				if(!needUpdateCookBoyList.contains(cookBoyData)){
					needUpdateCookBoyList.add(cookBoyData);
				}
			}
			UserInfo userInfo = UserMgr.getUserInfo(userId);
			RelationActivityMgr.conditionNotify(activityInfo.getActivityId(),userId, eGamePlayerEventType.CookBoy3IntegralUserCrossRank.getValue(),
					new RelationActivityUnionRiseRankArgs(UnionRiseRankArgs.NOTIFY_TYPE_NORMAL, BigInteger.valueOf(cookBoy3OpenItem.getIntegral()),userInfo.getUnionUid(), activityInfo.getActivityId()));

		}
	}

	//参加宴会
	public int sendJoinBanquetMsg(long userId,long homeUserId,int banquetId){
		//修复userInfo没有发送到跨服保存
		CookBoyProto.CrossCookBoy3OpenBanquetReqMsg.Builder reqMsgBug = CookBoyProto.CrossCookBoy3OpenBanquetReqMsg.newBuilder();
		reqMsgBug.setActivityId(activityInfo.getActivityId());
		reqMsgBug.setUserId(userId);
		reqMsgBug.setItemId(-1);
		UserInfo userInfo = UserMgr.getUserInfo(userId);
		reqMsgBug.setPlayerBaseData(PlayerBasePb.parsePlayerBaseTempMsg(UserMgr.parseUserBaseInfo(userInfo, GameServer.getInstance().getServerId())));
		YanQuMessage pbMsgBug = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_OPEN_BANQUET, reqMsgBug);
		GamePlayerMgr.sendPacket(userId, pbMsgBug);

		CookBoyProto.CookBoy3JoinBanquetReqMsg.Builder reqMsg = CookBoyProto.CookBoy3JoinBanquetReqMsg.newBuilder();
		reqMsg.setActivityId(activityInfo.getActivityId());
		reqMsg.setBanquetId(banquetId);
		reqMsg.setUserId(homeUserId);
		YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_JOIN_BANQUET, reqMsg);
		GamePlayerMgr.sendPacket(userId, pbMsg);
		return 0;
	}

	public int sendOpenTable(long userId,int itemId){
		GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
		if(player != null){
			CookBoyProto.CrossCookBoy3OpenBanquetReqMsg.Builder reqMsg = CookBoyProto.CrossCookBoy3OpenBanquetReqMsg.newBuilder();
			reqMsg.setActivityId(activityInfo.getActivityId());
			reqMsg.setUserId(userId);
			reqMsg.setItemId(itemId);
			reqMsg.setPlayerBaseData(PlayerBasePb.parsePlayerBaseTempMsg(UserMgr.parseUserBaseInfo(player.getUserInfo(), GameServer.getInstance().getServerId())));
			YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_OPEN_BANQUET, reqMsg);
			GamePlayerMgr.sendPacket(userId, pbMsg);
		}
		return 0;
	}

	public void syncCookBoy3Table(CookBoyProto.CrossCookBoy3TableSyncMsg msg){
		List<GamePlayer> userList = GamePlayerMgr.getAllOnlinePlayer();
		for(GamePlayer player : userList){
			//解锁了同步
			if(cookBoyDataMap.containsKey(player.getUserId())){
				CookBoyProto.CookBoy3CookerRespMsg.Builder syncMsg = CookBoyProto.CookBoy3CookerRespMsg.newBuilder();
				syncMsg.setIsSync(true);
				syncMsg.setRet(0);
				for(CookBoyProto.CookBoy3CookerCrossTempMsg tempMsg : msg.getTableListList()){
					CookBoyProto.CookBoy3CookerTempMsg.Builder tableMsg = CookBoyProto.CookBoy3CookerTempMsg.newBuilder();
					tableMsg.setRank(tempMsg.getRank());
					tableMsg.setUserId(tempMsg.getUserId());
					tableMsg.setOpenItemId(tempMsg.getOpenItemId());
					tableMsg.setBanquetId(tempMsg.getBanquetId());
					tableMsg.setOpenTime(tempMsg.getOpenTime());
					tableMsg.setUserNum(tempMsg.getUserNum());
					tableMsg.setBanquetCount(tempMsg.getBanquetCount());
					tableMsg.setUserInfo(tempMsg.getUserInfo());
					if(tempMsg.getBanquetId() != 0 && !tempMsg.getUserLitList().contains(player.getUserId())){
						tableMsg.setCanEat(true);
					}else{
						tableMsg.setCanEat(false);
					}
					syncMsg.addCookerList(tableMsg);
				}
				player.sendPacket(Protocol.U_COOK_BOY3_GET_TABLE_USER, syncMsg);
			}
		}
	}


	public void syncCookBoy3BanquetUserData(CookBoyProto.CookBoy3UserRewardSyncMsg msg){
		List<GamePlayer> userList = GamePlayerMgr.getAllOnlinePlayer();
		for(GamePlayer player : userList){
			CookBoyProto.CookBoy3UserRewardSyncMsg.Builder syncMsg = CookBoyProto.CookBoy3UserRewardSyncMsg.newBuilder(msg);
			player.sendPacket(Protocol.U_COOK_BOY3_BANQUET_USER_DATA_SYNC, syncMsg);
		}
	}

	public void syncCookBoy3BanquetOpenNotice(CookBoyProto.CookBoy3BanquetOpenSyncMsg msg){
		List<GamePlayer> userList = GamePlayerMgr.getAllOnlinePlayer();
		for(GamePlayer player : userList){
			CookBoyProto.CookBoy3BanquetOpenSyncMsg.Builder syncMsg = CookBoyProto.CookBoy3BanquetOpenSyncMsg.newBuilder(msg);
			player.sendPacket(Protocol.U_COOK_BOY3_OPEN_BANQUET_NOTICE_SYNC, syncMsg);
		}
	}

	public int sendCookerMsg(long userId,long homeUserId){
		//请求的时候要加上是不是进去场景的
		CookBoyProto.CookBoy3CookerReqMsg.Builder reqMsg = CookBoyProto.CookBoy3CookerReqMsg.newBuilder();
		reqMsg.setActivityId(activityInfo.getActivityId());
		reqMsg.setUserId(homeUserId);
		YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_COOKER_REQ, reqMsg);
		GamePlayerMgr.sendPacket(userId, pbMsg);
		return 0;
	}

	public CookBoyData getUserCookBoyData(GamePlayer player){
		if(!cookBoyDataMap.containsKey(player.getUserId())){
//			clearIntegral(player,CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId()));
			cookBoyDataMap.put(player.getUserId(),initCookBoy3(player.getUserId()));
		}else{
			reAddIntegral(player,CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId()));
		}
		return cookBoyDataMap.get(player.getUserId());
	}

	public void setUserCookBoy3Able(long userId){
		if(cookBoyDataMap.containsKey(userId)){
			cookBoyDataMap.get(userId).setAble(true);
		}
	}

	public boolean isUserCookBoy3Able(long userId){
		if(cookBoyDataMap.containsKey(userId)){
			return cookBoyDataMap.get(userId).isAble();
		}
		return false;
	}


	public void reAddIntegral(GamePlayer player,int itemId){
		Object locker = getLock(player.getUserId());
		synchronized (locker){
			int integralItemId = CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId());
			if(itemId == integralItemId){
				CookBoyData cookBoyData = cookBoyDataMap.get(player.getUserId());
				if(cookBoyData.getIntegral() > 0){
					player.getModule(CurrencyModule.class).addCurrency(integralItemId + "=" + cookBoyData.getIntegral(), eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoy3ActivityLogin);
					cookBoyData.setIntegral(0);
					synchronized (needUpdateCookBoyList){
						if(!needUpdateCookBoyList.contains(cookBoyData)){
							needUpdateCookBoyList.add(cookBoyData);
						}
					}
				}
			}
		}
	}

	public void clearIntegral(GamePlayer player,int itemId){
		Object locker = getLock(player.getUserId());
		synchronized (locker){
			int integralItemId = CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId());
			if(itemId == integralItemId){
				UserBagItem userBagItem = player.getModule(BagModule.class).getUserBagItem(integralItemId);
				if(userBagItem != null){
					player.getModule(CurrencyModule.class).removeCurrency(PropertyHelper.parseStringToProperty(integralItemId + "=" + userBagItem.getNum()), eLogMoneyType.CookBoy,eLogMoneyType.CrossCookBoy3ActivityNewAc);
				}
			}
		}
	}

	private CookBoyData initCookBoy3(long userId){
		CookBoyData temp = new CookBoyData();
		temp.setActivityId(activityInfo.getActivityId());
		temp.setUserId(userId);
		temp.setNo(activityInfo.getChildType());
		temp.setAble(false);
		temp.setIntegral(0);
		temp.setAllIntegral(0);
		temp.setHp(0);
		temp.setHpTime(System.currentTimeMillis());
		temp.setFinishFoodId(0);
		temp.setTableFoodData("{}");
		temp.setFinishFoodCount(0);
		temp.setFinishFoodData("{}");
		temp.setDishId(0);
		temp.setProcess(0);
		temp.setDishCount(0);
		synchronized (needAddCookBoyList){
			if(!needAddCookBoyList.contains(temp)){
				needAddCookBoyList.add(temp);
			}
		}
		return temp;
	}

	public boolean init() {
		return reload();
	}

	public boolean stop() {
		return false;
	}

	public boolean save() {
		/*if(System.currentTimeMillis() < 1629640800000L && !lockMap.containsKey(-880L)){
			String addInfo = "201002330003646=128000;";
			List<String> StringList = StringUtils.stringToStringList(addInfo,";");
			for(String infoStr : StringList){
				List<Long> listLong = StringUtils.stringToLongList(infoStr,"=");
				long userId = listLong.get(0);
				long integral = listLong.get(1);
				CookBoyData cookBoyData = cookBoyDataMap.get(userId);
				if(cookBoyData != null){
					synchronized (getLock(userId)){
						RelationActivityMgr.conditionNotify(activityInfo.getActivityId(),userId, eGamePlayerEventType.CookBoy3IntegralUserCrossRank.getValue(),
								new RelationActivityUnionRiseRankArgs(UnionRiseRankArgs.NOTIFY_TYPE_NORMAL, BigInteger.valueOf(integral),"", activityInfo.getActivityId()));
						cookBoyData.setAllIntegral(cookBoyData.getAllIntegral()+integral);
						logger.error(userId+"增加小当家阶段3"+getActivityInfo().getActivityId()+"积分"+integral);
						synchronized (needUpdateCookBoyList){
							if(!needUpdateCookBoyList.contains(cookBoyData)){
								needUpdateCookBoyList.add(cookBoyData);
							}
						}
					}
				}
			}
			lockMap.put(-880L,1L);
		}*/
		List<CookBoyData> tempAddList;
		synchronized (needAddCookBoyList) {
			tempAddList = new ArrayList<>(needAddCookBoyList);
			needAddCookBoyList.clear();
		}
		if (tempAddList.size() > 0) {
			UserCookBoyBussiness.addUserCooBoyList(tempAddList);
		}
		//保存记录
		List<CookBoyData> tempUpdataList;
		synchronized (needUpdateCookBoyList) {
			tempUpdataList = new ArrayList<>(needUpdateCookBoyList);
			needUpdateCookBoyList.clear();
		}
		if (tempUpdataList.size() > 0) {
			UserCookBoyBussiness.updateUserCookBoyList(tempUpdataList);
		}
		for (Long userId : new ArrayList<>(lockMap.keySet())) {
			if (userId < 0) {
				Object o = lockMap.get(userId);
				long time = (long) o;
				long l = System.currentTimeMillis() - time;
				if (l < 30000) {
					GamePlayer player = GamePlayerMgr.getOnlinePlayer(0 - userId);
					if (player != null) {
						player.getModule(CookBoyModule.class).syncSelfBanquetTable(activityInfo.getActivityId());
						reAddIntegral(player,CookBoyActivityMgr.getCookBoy3IntegralItemId(activityInfo.getActivityId()));
					}
				}

			}

		}
		return true;
	}

	public ActivityInfo getActivityInfo(){
		return activityInfo;
	}

	public boolean reload() {
		cookBoyDataMap = UserCookBoyBussiness.getUserCookBoyMap(activityInfo.getActivityId());
		return true;
	}

	public void setActivityInfo(ActivityInfo activityInfo){
		this.activityInfo = activityInfo;
	}

	public void openBanquetAddCondition(long userId) {
		RelationActivityMgr.conditionNotify(activityInfo.getActivityId(),userId, eGamePlayerEventType.CookBoy3BanquetOpenTimes.getValue(),1);
	}

	//加满参加阶段3
	private void test3(){
		List<ActivityInfo> activityInfoList = CookBoyActivityMgr.getOpenActivityInfoList(eActivityType.CookingBoyActivity.getValue(), eActivityCookBoyType.Process3.getChildType());
		for(ActivityInfo activityInfo : activityInfoList){
			CookBoyProto.CrossCookBoy3CookerJoinSyncMsg.Builder reqMsg = CookBoyProto.CrossCookBoy3CookerJoinSyncMsg.newBuilder();
			reqMsg.setActivityId(activityInfo.getActivityId());
			for(UserInfo userInfo : UserMgr.getUserInfoList()){
				if(!cookBoyDataMap.containsKey(userInfo.getUserId())){
					initCookBoy3(userInfo.getUserId());
				}
				setUserCookBoy3Able(userInfo.getUserId());
				CookBoyProto.CrossCookBoyWindUpCookerTempMsg.Builder userMsg = CookBoyProto.CrossCookBoyWindUpCookerTempMsg.newBuilder();
				userMsg.setUserId(userInfo.getUserId());
				userMsg.setScore(0);//不知道哪个前面的活动晋级的
				userMsg.setPlayerBaseData(PlayerBasePb.parsePlayerBaseTempMsg(UserMgr.parseUserBaseInfo(userInfo, GameServer.getInstance().getServerId())));
				reqMsg.addUserInfoList(userMsg);
			}
			YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_COOK_BOY3_COOKER_JOIN, reqMsg);
			GamePlayerMgr.sendPacket(0, pbMsg);
		}
	}
}
